var calendar = new lCalendar();
var starttimecalendar = new lCalendar();
var endtimecalendar = new lCalendar();
var resdata;
var url;
var trStr;
var trStr1;
var sendData = [];

$(document).ready(function(){
	document.getElementById("scrollid").style.width =Number($(window).width())-140 +'px';

 	gettitle();
	$('#name').text(sessionStorage.getItem("name"));
		$.ajax({
		url: "../../typd/InventorySelect"
		,type:'post'
		,data:JSON.stringify({"PaperNO":PaperNO})
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
				console.log(res.data);
					for (var i = 0; i < res.data.length; i++) {
					trStr   +='<tr>'
							//+'<td id="GoodsName'+i+'">'+res.data[i].GoodsName+'</td>'
							+'<td>'+res.data[i].Baseunit+'</td>'
							+'<td>'+res.data[i].StockQty+'</td>'
							+'<td>'+res.data[i].CheckQty+'</td>'
							+'<td>'+res.data[i].DiffQty+'</td>'
							+'<td>'+res.data[i].StockAmount+'</td>'
							+'<td>'+res.data[i].CheckAmount+'</td>'
							+'<td>'+res.data[i].DiffAmount+'</td>'
							+'</tr>'
						trStr1   +='<tr>'
							+'<td id="GoodsName'+i+'">'+res.data[i].GoodsName+'</td>'
							+'</tr>'
					}
			$('#shujvdiv').append(trStr);
		//	document.getElementById("GoodsName").style.marginTop  =0- (Number(res.data.length)*40+41) +'px';
			$('#shujvdiv1').append(trStr1);
			
			
			$("#scrollid2").css('-webkit-overflow-scrolling','auto'); 
			$("#scrollid2").scrollTop(9999); 
			$("#scrollid2").css('-webkit-overflow-scrolling','touch');
		/*	
					$("#shujvdiv td[id]").on("click",null,function(){
						var html = $(this).html();
						var id = $(this).attr("id");
						var value = $(this).text();
						if(value != undefined){
							//tips层-上
							layer.tips(value, '#'+id, {
								tips: [1, '#0FA6D8'] //还可配置颜色
							});	
						}
					})*/;	
	
		}
	});
	
});
function gettitle(){
	$.ajax({
		url: "../../typd/InventoryStoreDiffDtl"
		,type:'post'
		,data:JSON.stringify({"PaperNO":PaperNO})
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			$('#PaperNOH').append(res.data[0].PaperNO);
			$('#CheckAmount').append(res.data[0].CheckAmount);
			$('#CheckQty').append(res.data[0].CheckQty);
			$('#DiffAmount').append(res.data[0].DiffAmount);
			$('#DiffQty').append(res.data[0].DiffQty);
			$('#StockAmount').append(res.data[0].StockAmount);
			$('#StockQty').append(res.data[0].StockQty);
			$('#username').append(res.data[0].InventoryUser);
			//getusername(res.data[0].InventoryUser);
		}
	});
}
function getusername(InventoryUser){
	$.ajax({
		url: "../../typd/getusername"
		,type:'post'
		,data:JSON.stringify({"parameter":{"userId":InventoryUser}})
		,contentType: "application/json; charset=utf-8"
		,dataType:'json'
		,success: function(res){
			$('#username').append(res.data.field.name);
		}
	});
}